<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>学生信息修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <script src="../../layui/layui.js" charset="utf-8"></script>
    <script src="../../jquery/jquery.min.js" charset="utf-8"></script>
    <script>
$(function(){
        layui.use(['form', 'layedit', 'laydate'], function(){
            var form = layui.form
                    ,layer = layui.layer
                    ,layedit = layui.layedit
                    ,laydate = layui.laydate,
                    $ = layui.$;
            //监听提交
            form.on('submit(demo)', function (data) {
                var datas=data.field; //以json格式接收表单中所有的数据
                var action=data.form.action;
                $.ajax({
                    url:action,
                    data:datas,
                    type:"POST",
                    dataType:"json",
                    success:function(flag){
                        debugger;
                        if (flag==true) {
                            layer.msg('学生信息修改成功!',{icon: 1,time:3000}, function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭                        //刷新父页面
                                parent.location.reload();
                            });
                        } else{
                            layer.msg('修改失败！');
                        }
                    },
                    error:function(error){
                        console.log(error);
                    }
                });
                return false;
            });

        });
})
    </script>
</head>
<body>
<form class="layui-form layui-form-pane"  action="/student/updateStudentInfo" style="margin:auto; width:82%;" method="post" >
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
        <legend style="text-align:center;" ><h2>学生信息修改</h2></legend>
    </fieldset>
    <input id="sId" name="sId" type="hidden" value="${student.sId}">
    <div class="layui-form-item" style="text-align: center">
        <div class="layui-inline" style="margin-bottom: 30px;">
            <label class="layui-form-label">姓名：</label>
            <div class="layui-input-inline">
                <input type="text" name="sName"  class="layui-input"  lay-verify="required" value="${student.sName}">
            </div>
        </div>

        <div class="layui-inline" style="margin-bottom: 30px;">
            <label class="layui-form-label" >性别：</label>
            <div class="layui-input-inline">
                <input type="text" name="sSex"  class="layui-input"  lay-verify="required" value="${student.sSex}">
            </div>
        </div>

        <div class="layui-inline" style="margin-bottom: 30px;">
            <label class="layui-form-label" >学号：</label>
            <div class="layui-input-block">
                <input type="text" name="sClassNum"  class="layui-input"  lay-verify="required" value="${student.sClassNum}">
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="text-align: center">
        <div class="layui-inline">
            <label class="layui-form-label">所在学院</label>
            <div class="layui-input-inline">
                <select id="clName"  name="clName"  >
                    <option  value="${student.clName}">${student.clName}"</option>
                    <#list collegeList as l>
                    <option value="${l.clName}">${l.clName}</option>
                    </#list>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">所在班级</label>
            <div class="layui-input-inline">
                <select id="caName"  name="caName"  >
                    <option value="${student.caName}">${student.caName}</option>
                    <#list classList as l>
                    <option value="${l.caName}">${l.caName}</option>
                    </#list>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">所选课程</label>
            <div class="layui-input-inline">
                <select id="cName"  name="cName"  >
                    <option value="${student.cName}">${student.cName}</option>
                    <#list courseList as l>
                    <option value="${l.cName}">${l.cName}</option>
                    </#list>
                </select>
            </div>
        </div>
    </div>
    <br/>
    <div  class="layui-form-item" style="text-align: center">
        <div class="layui-inline" style="margin-bottom: 30px;">
            <label class="layui-form-label" >手机号：</label>
            <div class="layui-input-block">
                <input type="text" name="sPhone"  class="layui-input"  lay-verify="required" value="${student.sPhone}">
            </div>
        </div>
        <div class="layui-inline" style="margin-bottom: 30px;margin-left:20px">
            <label class="layui-form-label" >邮箱：</label>
            <div class="layui-input-block">
                <input type="text" name="sEmail"  class="layui-input"  lay-verify="required" value="${student.sEmail}">
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="text-align:center">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal layui-btn-lg" lay-submit=""  lay-filter="demo">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
    </div>
</form>
<div style="height:250px"></div>

</body>
</html>
